package org.soenea.ass2.application;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.soenea.ass2.services.datasource.GroupRDG;


/**
 * Servlet implementation class BrowseGroupsTS
 */
public class BrowseGroupsTS extends SampleHttpServlet {
	private static final long serialVersionUID = 1L;


	
    /**
     * @see HttpServlet#HttpServlet()
     */
    public BrowseGroupsTS() {
        super();
        // TODO Auto-generated constructor stub
    }

	protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		try {
			ArrayList<GroupRDG> groups = GroupRDG.findAll();
			
		
			request.getSession().setAttribute("groups", groups);
			request.getRequestDispatcher("browse_groups.jsp").forward(request, response);

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
